package cn.stylefeng.guns.modular.rest.basic;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.stylefeng.guns.core.util.DateUtil;
import cn.stylefeng.guns.modular.rest.aop.UserAop;
import cn.stylefeng.guns.modular.task.model.params.TaskFeedbackParam;
import cn.stylefeng.guns.modular.task.service.TaskFeedbackService;
import cn.stylefeng.guns.sys.modular.system.entity.User;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;

/**
 *作业反馈
 */
@Controller
@RequestMapping("/rest/feedback")
public class restFeedbackController extends BaseController {

    @Autowired
    private UserAop userAop;
    
    @Autowired
    private TaskFeedbackService taskFeedbackService;

    /**
     * 添加反馈
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(TaskFeedbackParam taskFeedbackParam) {
    	User user = userAop.getUser();
    	taskFeedbackParam.setUserName(user.getName());
    	taskFeedbackParam.setTimes(DateUtil.getDateS());
    	taskFeedbackParam.setDeptId(user.getDeptId());
    	taskFeedbackParam.setDeliverId(user.getDeliverId());
        this.taskFeedbackService.add(taskFeedbackParam);
        return ResponseData.success();
    }
    
    
}
